public class Test {
    public static void main(String[] args) {
        System.out.println(add(2, 3));
    }

    //自定义方法
    public static int add(int a,int b){
        return a + b;
    }
}

class TestMethod {
    public static void main(String[] args) {
        int[] arr = {10, 20};   //交换 arr[0] 和 arr[1] 的值
        swap(arr);
        System.out.println("arr[0] = " + arr[0] + " arr[1] = " + arr[1]);
    }
    public static void swap(int[] arr) {
        int tmp = arr[0];
        arr[0] = arr[1];
        arr[1] = tmp;
    }
}
//输出结果
//arr[0] = 20 arr[1] = 10



